﻿@using Top.Api.Response;
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_LayoutShow.cshtml";
    var MaterialList = ViewBag.MaterialList as List<TbkDgOptimusMaterialResponse.MapDataDomain>;
    long page = ViewBag.Page;
    long sort = 1 + ((page - 1) * 40);
}

<style>
    .title {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: block;
    }
</style>

<div class="content content-nav-base buytoday-content">
    <div id="list-cont">
        <div class="product-list-box">
            <div class="product-list w1200">
                <h4 style="font-size: 30px; color: #333;padding-bottom:30px;padding-top:30px;">TOP @(ViewBag.TotalCount) </h4>
                <div class="list-cont">
                    <div class="item-box layui-clear">
                        @foreach (var item in MaterialList)
                        {
                            <div class="item">
                                <span class="layui-badge layui-bg-orange " style="position: absolute;">@sort</span>
                                <img src="@item.PictUrl" alt="" style="width:290px;height:320px;">
                                <div class="text-box">
                                    <p class="title" style="width:280px;">@(string.IsNullOrWhiteSpace(item.ShortTitle)?item.Title:item.Title)</p>
                                    <p class="plic">
                                        <span class="ciur-pic" style="color:crimson;">￥@(decimal.Parse(item.ZkFinalPrice) - item.CouponAmount)</span>
                                        <span class="Ori-pic">￥@(item.ZkFinalPrice)</span>
                                        <span class="discount" onclick="window.location.href='@item.CouponClickUrl'" style="width:92px;"> 领取@(item.CouponAmount)元券</span>
                                    </p>
                                </div>
                            </div>
                            
                            sort += 1;
                            
                        }

                    </div>
                    <div id="demo0" style="text-align: center;"></div>
                </div>

            </div>
        </div>

    </div>
</div>



<script type="text/javascript">
        layui.config({
            base: '../Content/static/js/util/' //你存放新模块的目录，注意，不是layui的模块目录
        }).use(['mm', 'carousel', 'laypage'], function () {
            var carousel = layui.carousel, laypage = layui.laypage,
                mm = layui.mm;
            laypage.render({
                elem: 'demo0'
                , theme: '#f00582'
                , count: '@ViewBag.TotalCount' //数据总数
                , limit: '@ViewBag.Limit'
                , curr:'@ViewBag.Page'
                , jump: function (obj, first) {
                    //obj包含了当前分页的所有参数，比如：
                    console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                    console.log(obj.limit); //得到每页显示的条数

                    if (!first) {
                        window.location.href = "/Top?page=" + obj.curr +"#list-cont";
                    }
                }
            });

            var option = {
                elem: '#test1'
                , width: '100%' //设置容器宽度
                , arrow: 'always'
                , height: '298'
                , indicator: 'none'
            }
            carousel.render(option);
        });
</script>

